import logging
import unittest
from parameterized import parameterized
from api.MemberService import MemberService
from common.r_json import ms_add, ms_findMCBM


class Test_itheima_MS(unittest.TestCase):
    ms = None

    @classmethod
    def setUpClass(cls) -> None:
        cls.ms = MemberService()

    @unittest.skip("输出无法掌握")
    def test01_findByTelephone(self):
        resp = self.ms.findByTelephone("15507897413")
        self.assertEqual(12665, resp.get("id"))
        self.assertEqual("战斗暴龙兽", resp.get("name"))
        self.assertEqual("10007897419", resp.get("phoneNumber"))

    @parameterized.expand(ms_add)
    def test02_add(self, data, asser):
        resp = self.ms.add(data)
        self.assertEqual(asser,resp )

    @parameterized.expand(ms_findMCBM)
    def test03_findMemberCountByMonths(self, data, asser):
        resp = self.ms.findMemberCountByMonths(data.get("data"))
        self.assertEqual(resp, asser)
